package top.frsf.autocodegen.utils;

/**
 * @author FRSF
 * @date 2024/7/31 22:34
 * @desc 环境数据工具类
 */
public class EnvConfigUtil {

    /**
     * 获取用户桌面路径
     *
     * @return 用户桌面路径
     */
    public static String getUserDesktopPath() {
        String os = System.getProperty("os.name").toLowerCase();
        if (os.contains("win")) {
            // For Windows
            String userHome = System.getenv("USERPROFILE");
            if (userHome != null) {
                return userHome + "/Desktop/";
            }
        } else {
            // For Unix/Linux/MacOS
            String userHome = System.getProperty("user.home");
            if (userHome != null) {
                return userHome + "/Desktop/";
            }
        }
        // Fallback in case the above methods fail
        return System.getProperty("user.home");
    }


}
